<%@ page language="java" import="com.demo.util.Conn,java.sql.ResultSet" pageEncoding="UTF-8"%>
<%
String login = request.getParameter("login");
String pwd = request.getParameter("pwd");
String email = request.getParameter("email");

String sql = "insert into DBF_USER_COMPANY(login_name,password,email) values ('" + login + "','" + pwd + "','" + email + "')";
Conn conn = new Conn();
boolean result = conn.update(sql);
String redirect_address = "../login.jsp";

if (result == true) {
	sql = "select * from DBF_USER_COMPANY where login_name='" + login + "'";
	
	ResultSet rs = conn.find(sql);
	if (null != rs && rs.next()) {
		session.setAttribute("user_id", rs.getString("COMPANY_ID"));
		session.setAttribute("user_name", rs.getString("login_name"));
		session.setAttribute("user_type", "2");
		redirect_address = "index_com.jsp";
	}
}
response.sendRedirect(redirect_address);
%>